﻿using System;
using ZoneFiveSoftware.Common.Data.Fitness;
using ZoneFiveSoftware.Common.Visuals;

namespace LinuxGarminImport
{
    class NotesCleanup : IAction
    {
        #region Fields

        private static IActivity activity;

        #endregion

        #region Properties

        public static IActivity Activity
        {
            set { activity = value; }
        }

        #endregion

        #region IAction Members

        public bool Enabled
        {
            get
            {
                if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }

        public bool HasMenuArrow
        {
            get { return false; }
        }

        public System.Drawing.Image Image
        {
            get { return CommonResources.Images.Edit16; }
        }

        public void Refresh()
        {
            throw new NotImplementedException();
        }

        public void Run(System.Drawing.Rectangle rectButton)
        {
            // Cleans garbage out of notes field.
            activity.Notes = activity.Notes.Replace("\n", "\r\n");
            activity.Notes = activity.Notes.Replace("\r\r\n", "\r\n");
        }

        public string Title
        {
            get { return "Notes Cleanup"; }
        }

        #endregion

        #region INotifyPropertyChanged Members

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
}
